package com.jeesite.modules.tk.entity;

import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.Date;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.ic.entity.IcUser;
import lombok.Getter;

/**
 * tk_taskEntity
 * @author 李寒冰
 * @version 2024-12-05
 */
@Table(name="tk_task", alias="a", label="tk_task信息", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="project_name", attrName="projectName", label="项目名称/APP名称", queryType=QueryType.LIKE),
		@Column(name="title", attrName="title", label="标题", queryType=QueryType.LIKE),
		@Column(name="user_id", attrName="userId", label="商家ID"),
		@Column(name="explain_str", attrName="explainStr", label="描述"),
		@Column(name="submit_times", attrName="submitTimes", label="提交时常"),
		@Column(name="examine_times", attrName="examineTimes", label="审核时常"),
		@Column(name="dev_type", attrName="devType", label="设备类型 0 不限 1安卓 2 IOS", isUpdateForce=true),
		@Column(name="zuodan_num_type", attrName="zuodanNumType", label="做单方式", isUpdateForce=true),
		@Column(name="price", attrName="price", label="悬赏单价", isUpdateForce=true),
		@Column(name="yu_do_num", attrName="yuDoNum", label="悬赏名额", isUpdateForce=true),
		@Column(name="yufu_jine", attrName="yufuJine", label="预付赏金", isUpdateForce=true),
		@Column(name="zuodan_num", attrName="zuodanNum", label="做单次数", isUpdateForce=true),
		@Column(name="buzhou_list", attrName="buzhouList", label="做单步骤"),
		@Column(name="create_time", attrName="createTime", label="创建时间", isUpdateForce=true),
		@Column(name="task_status", attrName="taskStatus", label="任务状态", comment="任务状态：0 审核中 1已上线  2已下架 3审核失败 4违规 5结束"),
		@Column(name="fuwufei", attrName="fuwufei", label="服务费", comment="服务费"),
		@Column(name="fail_explain", attrName="failExplain", label="审核失败说明/ 违规说明", comment="审核失败说明/ 违规说明"),
		@Column(name="update_time", attrName="updateTime", label="审核失败说明/ 违规说明", comment="审核失败说明/ 违规说明"),
		@Column(name="task_code", attrName="taskCode", label="审核失败说明/ 违规说明", comment="审核失败说明/ 违规说明"),
		@Column(name="task_type", attrName="taskType", label="任务类型", comment="任务类型"),
		@Column(name="xzb_task_id", attrName="xzbTaskId", label="小转帮任务ID", comment="小转帮任务ID"),
		@Column(name="type", attrName="type", label="任务类型（1用户任务 2小转帮 3平台任务）", comment="任务类型（1用户任务 2小转帮 3平台任务）"),
	}, orderBy="a.id DESC"
)

public class TkTask extends DataEntity<TkTask> {


	private static final long serialVersionUID = 1L;
	private String projectName;		// 项目名称/APP名称
	private String title;		// 标题
	private String userId;		// 商家ID
	private String explainStr;		// 描述
	private String submitTimes;		// 提交时常
	private String examineTimes;		// 审核时常
	private Integer devType;		// 设备类型 0 不限 1安卓 2 IOS
	private Integer zuodanNumType;		// 做单方式
	private Double price;		// 悬赏单价
	private Integer yuDoNum;		// 悬赏名额
	private Double yufuJine;		// 预付赏金
	private Integer zuodanNum;		// 做单次数
	private String buzhouList;		// 做单步骤
	private Date createTime;		// 创建时间
	private String taskStatus;		// 任务状态：0 审核中 1已上线  2已下架 3审核失败 4违规
	private String xzbTaskId;
	private String type;

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	/**
	 * 服务费
	 */
	private BigDecimal fuwufei;

	/**
	 * 审核失败说明/ 违规说明
	 */
	private String failExplain;

	private Date updateTime;
	/**
	 * 任务编号
	 */
	private String taskCode;

	/**
	 * 任务类型
	 */
	private String taskType;

	//扩展字段
	private IcUser icUser;

	public IcUser getIcUser() {
		return icUser;
	}

	public void setIcUser(IcUser icUser) {
		this.icUser = icUser;
	}

	public BigDecimal getFuwufei() {
		return fuwufei;
	}

	public void setFuwufei(BigDecimal fuwufei) {
		this.fuwufei = fuwufei;
	}

	public String getFailExplain() {
		return failExplain;
	}

	public void setFailExplain(String failExplain) {
		this.failExplain = failExplain;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getTaskCode() {
		return taskCode;
	}

	public void setTaskCode(String taskCode) {
		this.taskCode = taskCode;
	}

	public String getTaskType() {
		return taskType;
	}

	public void setTaskType(String taskType) {
		this.taskType = taskType;
	}

	public TkTask() {
		this(null);
	}
	
	public TkTask(String id){
		super(id);
	}

	public String getXzbTaskId() {
		return xzbTaskId;
	}

	public void setXzbTaskId(String xzbTaskId) {
		this.xzbTaskId = xzbTaskId;
	}

	@Size(min=0, max=255, message="项目名称/APP名称长度不能超过 255 个字符")
	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	
	@Size(min=0, max=255, message="标题长度不能超过 255 个字符")
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	@Size(min=0, max=50, message="商家ID长度不能超过 50 个字符")
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getExplainStr() {
		return explainStr;
	}

	public void setExplainStr(String explainStr) {
		this.explainStr = explainStr;
	}

	@Size(min=0, max=10, message="提交时常长度不能超过 10 个字符")
	public String getSubmitTimes() {
		return submitTimes;
	}

	public void setSubmitTimes(String submitTimes) {
		this.submitTimes = submitTimes;
	}
	
	@Size(min=0, max=10, message="审核时常长度不能超过 10 个字符")
	public String getExamineTimes() {
		return examineTimes;
	}

	public void setExamineTimes(String examineTimes) {
		this.examineTimes = examineTimes;
	}
	
	public Integer getDevType() {
		return devType;
	}

	public void setDevType(Integer devType) {
		this.devType = devType;
	}
	
	public Integer getZuodanNumType() {
		return zuodanNumType;
	}

	public void setZuodanNumType(Integer zuodanNumType) {
		this.zuodanNumType = zuodanNumType;
	}
	
	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}
	
	public Integer getYuDoNum() {
		return yuDoNum;
	}

	public void setYuDoNum(Integer yuDoNum) {
		this.yuDoNum = yuDoNum;
	}
	
	public Double getYufuJine() {
		return yufuJine;
	}

	public void setYufuJine(Double yufuJine) {
		this.yufuJine = yufuJine;
	}
	
	public Integer getZuodanNum() {
		return zuodanNum;
	}

	public void setZuodanNum(Integer zuodanNum) {
		this.zuodanNum = zuodanNum;
	}
	
	public String getBuzhouList() {
		return buzhouList;
	}

	public void setBuzhouList(String buzhouList) {
		this.buzhouList = buzhouList;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@Size(min=0, max=10, message="任务状态长度不能超过 10 个字符")
	public String getTaskStatus() {
		return taskStatus;
	}

	public void setTaskStatus(String taskStatus) {
		this.taskStatus = taskStatus;
	}

	public void setXZBTaskIdIsNull(){
		this.sqlMap.getWhere().and("xzb_task_id",QueryType.IS_NULL,"");
	}

	//做单步骤类型
	@Getter
	public enum BuzhouType{

		WANGZHI("wangzhi","输入网址"),
		ERWEIMA("erweima","传二维码"),
		TUWEN("tuwen","图文说明"),
		WENZI("wenzi","文字说明"),
		SHUJU("shuju","复制数据（如邀请码）"),
		JIETU("jietu","收集截图"),
		SHOUJI("shouji","收集信息"),
		MOBILE("mobile","收集手机号"),
		;

		private String code;
		private String name;

		private BuzhouType(String code,String name){
			this.code = code;
			this.name = name;
		}

		public static String getNameByCode(String code){
			for(BuzhouType b:BuzhouType.values()){
				if(b.getCode().equals(code)){
					return b.name;
				}
			}
			return null;
		}

	}
	
}